package com.elitesland.metadata.entity;

import com.elitesland.core.base.BaseModel;
import com.elitesland.system.annotation.Comment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;

/**
 * <pre>作用说明</pre>
 *
 * @author mir
 * @date 11/28/2020 1:10 AM
 */
@Entity
@Table(name = "meta_catdef")
@org.hibernate.annotations.Table(appliesTo = "meta_catdef", comment = "自选分类定义")
@Data
@Accessors(chain = true)
@ApiModel(value = "自选分类定义", description = "自选分类定义")
public class MetaCatDefDO extends BaseModel implements Serializable {

    private static final long serialVersionUID = 3909625005779440222L;

    @ApiModelProperty(value = "自选分类表定义ID")
    @Comment("自选分类表定义ID")
    @Column()
    Long tableId;

    @ApiModelProperty(value = "自选分类表定义编码")
    @Comment("自选分类表定义编码")
    @Column()
    String tableCode;

    @ApiModelProperty(value = "数据库字段名称")
    @Comment("数据库字段名称")
    @Column()
    String fieldName;

    @ApiModelProperty(value = "顺序号")
    @Comment("顺序号")
    @Column()
    Integer sortNo;

    @ApiModelProperty(value = "UDC领域码")
    @Comment("UDC领域码")
    @Column()
    String domainCode;

    @ApiModelProperty(value = "UDC分类码")
    @Comment("UDC分类码")
    @Column()
    String udcCode;

    @ApiModelProperty(value = "默认UDC名称")
    @Comment("默认UDC名称")
    @Column()
    String defaultUdcName;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof MetaCatDefDO)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        MetaCatDefDO entity = (MetaCatDefDO) o;
        return getId().equals(entity.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId());
    }
}